//
//  DKHomeTranFailView.m
//  DanKU
//
//  Created by 吴斌 on 2023/10/7.
//

#import "DKHomeTranFailView.h"

@implementation DKHomeTranFailView
-(instancetype)init{
    if(self == [super init]){
        self.backgroundColor = UIColor.whiteColor;
        self.layer.cornerRadius = DK_IsWidthScale(10);
        [self dk_addSubView];
    }
    return self;
}
- (void)dk_addSubView{
    UIImageView* dk_HomeBgImgView = [[UIImageView alloc] init];
    dk_HomeBgImgView.userInteractionEnabled = YES;
    dk_HomeBgImgView.image = DK_GetImage(@"dk_HomeAuthorizeTranFailHead");
    [self addSubview:dk_HomeBgImgView];
    [dk_HomeBgImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(DK_IsWidthScale(20)));
        make.top.equalTo(@(DK_IsWidthScale(10)));
        make.bottom.equalTo(@(-DK_IsWidthScale(10)));
        make.width.equalTo(@(DK_IsWidthScale(35)));
    }];
    UILabel *dk_tranHeadLab = [[UILabel alloc] init];
    dk_tranHeadLab.textColor = DK_Hex(@"#000000");
    dk_tranHeadLab.font = DK_FONT_Medium(15);
    dk_tranHeadLab.text = @"Transaction failed！";
    [self addSubview:dk_tranHeadLab];
    [dk_tranHeadLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(dk_HomeBgImgView.mas_right).offset(DK_IsWidthScale(15));
        make.top.equalTo(@(DK_IsWidthScale(7)));
        make.height.equalTo(@(DK_IsWidthScale(21)));
    }];
    UILabel *dk_tranBottomLab = [[UILabel alloc] init];
    dk_tranBottomLab.textColor = DK_Hex(@"#000000");
    dk_tranBottomLab.font = DK_FONT_Regular(12);
    dk_tranBottomLab.text = @"Check your bank account details";
    [self addSubview:dk_tranBottomLab];
    [dk_tranBottomLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(dk_tranHeadLab);
        make.top.equalTo(dk_tranHeadLab.mas_bottom);
        make.height.equalTo(@(DK_IsWidthScale(17)));
    }];
    UIButton * dk_tranBackBtn = [[UIButton alloc] init];
    [dk_tranBackBtn setBackgroundImage:DK_GetImage(@"dk_HomeAuthorizeTranFailGo") forState:UIControlStateNormal];
    [dk_tranBackBtn addTarget:self action:@selector(changeBankCard) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:dk_tranBackBtn];
    [dk_tranBackBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(@(-DK_IsWidthScale(39)));
        make.top.equalTo(@(DK_IsWidthScale(18)));
        make.bottom.equalTo(@(-DK_IsWidthScale(18)));
        make.width.equalTo(dk_tranBackBtn.mas_height);
    }];
}
- (void)changeBankCard{
    if(self.HomeTranFailBlock){
        self.HomeTranFailBlock();
    }
}
@end
